package com.qf.tools;

import org.springframework.core.convert.converter.Converter;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class MyString_DateConterver implements Converter<String, Date> {
    @Override
    public Date convert(String source) {
        SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");

        if (source != null&&source!="") {
            try {
                return format.parse(source);
            } catch (ParseException e) {
                e.printStackTrace();
            }
        }

        return null;
    }
}
